home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1996-10-28 | 3.2 KB | 116 lines |
- 10 'DISHMATH - rev. 29 OCT 96 adapted from PARABOLA program
- 20 CLS:KEY OFF
- 30 COMMON EX$
- 40 COLOR 7,0,1:
- 50 SCREEN 0
- 60 FO=0:LG=0:HT=0:FA=0
- 70 COLOR 7,0,1
- 80 PI=3.14159
- 90 U$=STRING$(80,205)
- 100 COLOR 15,2
- 110 PRINT " PARABOLIC CURVE";TAB(57)"by George Murphy VE3ERP ";
- 120 COLOR 1,0
- 130 PRINT STRING$(80,223);
- 140 COLOR 7,0
- 150 PRINT " WARNING! If your computer configuration does not support high"
- 160 PRINT " resolution graphics then this program may produce some uncanny"
- 170 PRINT " displays, or it may not work at all..........................."
- 180 PRINT U$;
- 190 PRINT " Press number in < > to:
- 200 PRINT U$;
- 210 PRINT " < 1 > DRAW a parabolic curve"
- 220 PRINT " < 0 > RETURN to menu"
- 230 Z$=INKEY$:IF Z$="0"THEN CLS:CHAIN"\bas\prog\dishant"
- 240 IF Z$="1"THEN 250 ELSE 230
- 250 VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
- 260 GOSUB 900:PRINT U$;
- 270 IF FO=0 THEN INPUT " ENTER: Focus: (X-axis) .....";FO:GOSUB 320
- 280 IF LG=0 THEN INPUT " ENTER: Depth: (X-axis) .....";LG:GOSUB 320
- 290 IF HT=0 THEN INPUT " ENTER: Height: (Y-axis) .....";HT:GOSUB 320
- 300 IF FO*LG*HT THEN 370 ELSE 270
- 310 '
- 320 IF FO=0 THEN IF HT*LG THEN FO=HT^2/(4*LG)
- 330 IF LG=0 THEN IF FO*HT THEN LG=HT^2/(4*FO)
- 340 IF HT=0 THEN IF FO*LG THEN HT=SQR(4*FO*LG)
- 350 RETURN
- 360 '
- 370 '.....calculate focal angle
- 375 COLOR 15,1
- 380 'X=640 'hi-res screen length in pixels
- 390 'Y=350 'hi-res screen height in pixels
- 400 'R=Y/X 'height/width ratio
- 410 R=0.75 'ratio for SVGA monitor
- 420 IF FA=0 THEN FA=ATN(HT/(FO-LG))
- 430 IF FA<0 THEN FA=PI+FA
- 440 GOTO 490
- 450 '
- 460 H=HT*S:F=FO*S:L=LG*S
- 470 RETURN
- 480 '
- 490 S=150/HT:GOSUB 460
- 500 IF F>(450*R) THEN S=450*R/FO:GOSUB 460
- 510 IF L>(450*R) THEN S=450*R/LG:GOSUB 460:GOTO 500
- 520 IF H>150 THEN S=150/H:GOSUB 460:GOTO 500
- 530 '
- 540 X=10:Y=250
- 550 SCREEN 9:COLOR 15,1:PRINT " PARABOLIC CURVE:
- 560 PRINT " o = Focal Point"
- 570 PSET (X,Y)
- 580 '
- 590 FOR Z=1 TO H
- 600 A=Z^2/(4*F)/R
- 610 PSET (X+A,Y-Z)
- 620 NEXT Z
- 630 LINE(X,Y)-(L/R+X,Y)
- 640 FF=F/R:LINE-(FF+X,Y),,,&H5555
- 650 LINE(L/R+X,Y-2)-(L/R+X,Y+2)
- 660 CIRCLE (FF+X,Y),4
- 670 CIRCLE (L/R+X,Y-H),2 'END OF CURVE
- 680 W=H/2:P=W^2/(4*F)/R
- 690 IF F>L THEN E=F ELSE E=L
- 700 E=E/R
- 710 LINE (FF+X,Y)-(P+X,Y-W),,,&H5555
- 720 LINE -(480,Y-W),,,&H1111
- 730 LINE (FF+X,Y)-(L/R+X,Y-H),,,&H5555
- 740 LINE -(480,Y-H),,,&H1111
- 750 FOR Z=6 TO H STEP 6
- 760 PSET(L/R+X,Y-Z):NEXT Z
- 770 CIRCLE (FF+X,Y),FF/3,,PI-FA,PI,R
- 780 LOCATE 22:PRINT " Focus=";FO;" Height=";HT;" Depth=";LG;
- 790 PRINT " Acceptance Angle= ";USING "###.#";FA*180/PI;:PRINT CHR$(248)
- 800 Q=2
- 810 LOCATE 23:
- 820 INPUT " ENTER 0 to exit or value of Y (height) to plot X (depth): ";T
- 830 LOCATE 23:PRINT STRING$(80,32);
- 840 IF T=0 THEN 50 ELSE LOCATE 1,58:PRINT "X";TAB(72);"Y"
- 850 V=T^2/4/FO:N=(V*S)/R+X
- 860 LINE (N,Y)-(N,Y-T*S)
- 870 Q=Q+1:LOCATE Q,57:PRINT V;TAB(71);T
- 880 GOTO 810
- 890 '
- 900 '.....preface
- 910 TB=7
- 920 PRINT TAB(TB);
- 930 PRINT "The formula for plotting a parabolic curve is X=Y<UNK! {FD2F}>4F, where X is"
- 940 PRINT TAB(TB);
- 950 PRINT "the depth, Y is the height, and F is the focus. Enter any two of"
- 960 PRINT TAB(TB);
- 970 PRINT "these values to find the third value and to plot an appropriately"
- 980 PRINT TAB(TB);
- 990 PRINT "scaled parabolic curve."
- 1000 PRINT
- 1010 PRINT TAB(TB);
- 1020 PRINT "In terms of practical parabolic reflectors depth X is the distance"
- 1030 PRINT TAB(TB);
- 1040 PRINT "from the back of the dish to the plane formed by the rim of the"
- 1050 PRINT TAB(TB);
- 1060 PRINT "dish, height Y is the radius of the rim, focus F is the distance"
- 1070 PRINT TAB(TB);
- 1080 PRINT "along the dish axis from the back of the dish to the focal point."
- 1090 PRINT
- 1100 PRINT TAB(TB);
- 1110 PRINT "The focal point is the location of the lamp in a spotlight, the"
- 1120 PRINT TAB(TB);
- 1130 PRINT "antenna in an RF reflector, and the microphone in an audio snooper."
- 1140 RETURN
-